3.866 \(\int \cos ^2(c+d x) (a+b \sec (c+d x)) (A+B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\)

Optimal. Leaf size=69 \[ \frac{(a B+A b) \sin (c+d x)}{d}+\frac{1}{2} x (a (A+2 C)+2 b B)+\frac{a A \sin (c+d x) \cos (c+d x)}{2 d}+\frac{b C \tanh ^{-1}(\sin (c+d x))}{d} \]

[Out]

((2*b*B + a*(A + 2*C))*x)/2 + (b*C*ArcTanh[Sin[c + d*x]])/d + ((A*b + a*B)*Sin[c + d*x])/d + (a*A*Cos[c + d*x]
*Sin[c + d*x])/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.15622, antiderivative size = 69, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 39, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.128, Rules used = {4074, 4047, 8, 4045, 3770} \[ \frac{(a B+A b) \sin (c+d x)}{d}+\frac{1}{2} x (a (A+2 C)+2 b B)+\frac{a A \sin (c+d x) \cos (c+d x)}{2 d}+\frac{b C \tanh ^{-1}(\sin (c+d x))}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

((2*b*B + a*(A + 2*C))*x)/2 + (b*C*ArcTanh[Sin[c + d*x]])/d + ((A*b + a*B)*Sin[c + d*x])/d + (a*A*Cos[c + d*x]
*Sin[c + d*x])/(2*d)

Rule 4074

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^
(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(A*a*Cot[e + f*x]*(d*Csc[e + f*x])^n)/(f*n), x]
 + Dist[1/(d*n), Int[(d*Csc[e + f*x])^(n + 1)*Simp[n*(B*a + A*b) + (n*(a*C + B*b) + A*a*(n + 1))*Csc[e + f*x]
+ b*C*n*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C}, x] && LtQ[n, -1]

Rule 4047

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 4045

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(A*Cot[e
 + f*x]*(b*Csc[e + f*x])^m)/(f*m), x] + Dist[(C*m + A*(m + 1))/(b^2*m), Int[(b*Csc[e + f*x])^(m + 2), x], x] /
; FreeQ[{b, e, f, A, C}, x] && NeQ[C*m + A*(m + 1), 0] && LeQ[m, -1]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cos ^2(c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac{a A \cos (c+d x) \sin (c+d x)}{2 d}-\frac{1}{2} \int \cos (c+d x) \left (-2 (A b+a B)-(2 b B+a (A+2 C)) \sec (c+d x)-2 b C \sec ^2(c+d x)\right ) \, dx\\ &=\frac{a A \cos (c+d x) \sin (c+d x)}{2 d}-\frac{1}{2} \int \cos (c+d x) \left (-2 (A b+a B)-2 b C \sec ^2(c+d x)\right ) \, dx-\frac{1}{2} (-2 b B-a (A+2 C)) \int 1 \, dx\\ &=\frac{1}{2} (2 b B+a (A+2 C)) x+\frac{(A b+a B) \sin (c+d x)}{d}+\frac{a A \cos (c+d x) \sin (c+d x)}{2 d}+(b C) \int \sec (c+d x) \, dx\\ &=\frac{1}{2} (2 b B+a (A+2 C)) x+\frac{b C \tanh ^{-1}(\sin (c+d x))}{d}+\frac{(A b+a B) \sin (c+d x)}{d}+\frac{a A \cos (c+d x) \sin (c+d x)}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.122287, size = 68, normalized size = 0.99 \[ \frac{4 (a B+A b) \sin (c+d x)+a A \sin (2 (c+d x))+2 a A c+2 a A d x+4 a C d x+4 b B d x+4 b C \tanh ^{-1}(\sin (c+d x))}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(2*a*A*c + 2*a*A*d*x + 4*b*B*d*x + 4*a*C*d*x + 4*b*C*ArcTanh[Sin[c + d*x]] + 4*(A*b + a*B)*Sin[c + d*x] + a*A*
Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]  time = 0.064, size = 100, normalized size = 1.5 \begin{align*}{\frac{Aa\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2\,d}}+{\frac{aAx}{2}}+{\frac{Aac}{2\,d}}+{\frac{Ba\sin \left ( dx+c \right ) }{d}}+aCx+{\frac{Cac}{d}}+{\frac{Ab\sin \left ( dx+c \right ) }{d}}+Bbx+{\frac{Bbc}{d}}+{\frac{Cb\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x)

[Out]

1/2*a*A*cos(d*x+c)*sin(d*x+c)/d+1/2*a*A*x+1/2/d*A*a*c+a*B*sin(d*x+c)/d+a*C*x+1/d*C*a*c+A*b*sin(d*x+c)/d+B*b*x+
1/d*B*b*c+1/d*C*b*ln(sec(d*x+c)+tan(d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.03043, size = 120, normalized size = 1.74 \begin{align*} \frac{{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a + 4 \,{\left (d x + c\right )} C a + 4 \,{\left (d x + c\right )} B b + 2 \, C b{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a \sin \left (d x + c\right ) + 4 \, A b \sin \left (d x + c\right )}{4 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a + 4*(d*x + c)*C*a + 4*(d*x + c)*B*b + 2*C*b*(log(sin(d*x + c) + 1) -
 log(sin(d*x + c) - 1)) + 4*B*a*sin(d*x + c) + 4*A*b*sin(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 0.541492, size = 192, normalized size = 2.78 \begin{align*} \frac{{\left ({\left (A + 2 \, C\right )} a + 2 \, B b\right )} d x + C b \log \left (\sin \left (d x + c\right ) + 1\right ) - C b \log \left (-\sin \left (d x + c\right ) + 1\right ) +{\left (A a \cos \left (d x + c\right ) + 2 \, B a + 2 \, A b\right )} \sin \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(((A + 2*C)*a + 2*B*b)*d*x + C*b*log(sin(d*x + c) + 1) - C*b*log(-sin(d*x + c) + 1) + (A*a*cos(d*x + c) +
2*B*a + 2*A*b)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.19254, size = 215, normalized size = 3.12 \begin{align*} \frac{2 \, C b \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, C b \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right ) +{\left (A a + 2 \, C a + 2 \, B b\right )}{\left (d x + c\right )} - \frac{2 \,{\left (A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 2 \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 2 \, A b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - A a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, B a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 2 \, A b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(2*C*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 2*C*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + (A*a + 2*C*a + 2*B*
b)*(d*x + c) - 2*(A*a*tan(1/2*d*x + 1/2*c)^3 - 2*B*a*tan(1/2*d*x + 1/2*c)^3 - 2*A*b*tan(1/2*d*x + 1/2*c)^3 - A
*a*tan(1/2*d*x + 1/2*c) - 2*B*a*tan(1/2*d*x + 1/2*c) - 2*A*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1
)^2)/d